﻿using System;

namespace Z.GenerateIconProject.WinForm.BL
{
    public partial class ApplicationConfiguration
    {
        public static ApplicationConfiguration Load()
        {
            if (ConfigurationConfigurationFilePath.ToFileInfo().Exists)
            {
                try
                {
                    string s = ConfigurationConfigurationFilePath.ToFileInfo().ReadToEnd();
                    var applicationConfiguration = s.DeserializeXml<ApplicationConfiguration>();

                    return applicationConfiguration;
                }
                catch (Exception)
                {
                    return new ApplicationConfiguration();
                }
            }
            return new ApplicationConfiguration();
        }
    }
}